Skip to content

Conversation

@MatusKysel
Copy link
Contributor

Description

In the original flamegraph (run before any caching), reth_bsc::node::evm::pre_execution::verify_vote_attestation accounted for 5.49 % of total samples and the BLST Signature::fast_aggregate_verify underneath it took another 5.32 %.

@MatusKysel MatusKysel requested review from joey0612 and will-2012 and removed request for graceharuki and joey0612 December 2, 2025 12:31
LazyLock::new(|| Mutex::new(HashMap::new()));

static BLS_PUBKEY_CACHE: LazyLock<Mutex<BlsPublicKeyCache>> =
LazyLock::new(|| Mutex::new(HashMap::new()));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SNAPSHOT_FINGERPRINT_CACHE / BLS_PUBKEY_CACHE: Are there memory issues if the instance runs for an extended period of time?

Copilot AI review requested due to automatic review settings December 12, 2025 08:07
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds caching to attestation verification to improve performance. According to the flamegraph analysis, verify_vote_attestation and the underlying BLST signature verification were consuming over 10% of total execution time. The changes introduce three new caches to avoid redundant cryptographic operations and validator set processing.

  • Adds attestation verification result caching to skip expensive BLS signature verification for already-validated attestations
  • Implements snapshot fingerprinting and BLS public key caching to reuse parsed cryptographic objects
  • Refactors validator address derivation into a dedicated method to eliminate code duplication

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/node/evm/pre_execution.rs Adds three new caches (attestation verification, snapshot fingerprint, BLS public keys) and integrates them into the attestation verification flow. Includes unit tests for cache behavior.
src/node/miner/config.rs Refactors validator address derivation logic into the new derive_validator_address_from_keys() method and updates tests to use shared helper functions.
src/rpc/mev.rs Simplifies MEV API initialization by removing inline key derivation logic and relying solely on the configured validator address.
src/main.rs Adds explicit error handling for validator address derivation during mining configuration setup.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@MatusKysel MatusKysel requested a review from galaio December 12, 2025 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants